#include <QDebug>
#include <QString>
#include "spymon.h"

/********************************
  Log Levels

  0: fatal
  1: critical
  2: error
  3: warning
  4: informational
  5: debugging
  6: sql queries
  7: sql results

********************************/

SpyMon::SpyMon(QObject *parent) :
    QObject(parent)
{
    logLevel = 7;
    qDebug() << "constructed SpyMon";
}

SpyMon::~SpyMon()
{
    qDebug() << "deconstruced SpyMon";
}

void SpyMon::logFromServer(int lvl, QString msg)
{
    if (lvl <= logLevel)
        qDebug() << QString("[SpyServer] " + msg);
}

void SpyMon::logFromThread(int lvl, QString msg)
{
    if (lvl <= logLevel)
        qDebug() << QString("[thread] " + msg);
}

void SpyMon::logFromNet(int id, int lvl, QString msg)
{
    if (lvl <= logLevel)
        qDebug() << QString(id + " net: " + msg);
}

void SpyMon::logFromCmd(int id, int lvl, QString msg)
{
    if (lvl <= logLevel)
        qDebug() << QString(id + " cmd: " + msg);
}

void SpyMon::logFromDb(int id, int lvl, QString msg)
{
    if (lvl <= logLevel)
        qDebug() << QString(id + " db: " + msg);
}
